﻿using System;
using PostSharp.Aspects;
using BizElements.BusinessLayer;

namespace BizElements.BusinessLayer.Aspects
{
    /// <summary>
    /// Provides details for attributes dealing with logging aspect.
    /// </summary>
    public interface ILogDetailProvider
    {
        #region Get methods.

        /// <summary>
        /// Gets actor which is executing the transaction.
        /// </summary>
        /// <param name="eventArgs">Event arguments specifying which method is being executed and which are its arguments.</param>
        /// <returns><see cref="IActor"/> object or null if actor cannot be determined.</returns>
        IActor GetActor(MethodExecutionArgs eventArgs);

        /// <summary>
        /// Gets type of the object/entity associated with the transaction. Typically table or class name.
        /// </summary>
        /// <param name="eventArgs">Event arguments specifying which method is being executed and which are its arguments.</param>
        /// <returns>Type of object.</returns>
        string GetObjectType(MethodExecutionArgs eventArgs);

        /// <summary>
        /// Gets ID of the object/entity associated with the transaction.
        /// </summary>
        /// <param name="eventArgs">Event arguments specifying which method is being executed and which are its arguments.</param>
        /// <returns>ID tag or null if it cannot be determined.</returns>
        object GetObjectId(MethodExecutionArgs eventArgs);

        /// <summary>
        /// Gets array of object's public properties to be recorded.
        /// </summary>
        /// <param name="eventArgs">Event arguments specifying which method is being executed and which are its arguments.</param>
        /// <returns>Property names which are to be logged; empty array if no properties are to be logged.</returns>
        string[] GetLoggedProperties(MethodExecutionArgs eventArgs);

        #endregion
    }
}